package com.alibaba.citrus.cr.sales.plan.functions.departmentcontractredline;

import com.alibaba.citrus.cr.common.util.SpringContextUtil;
import com.alibaba.citrus.cr.sales.plan.repository.DepartmentContractRedLineRepository;
import com.alibaba.citrus.cr.sales.plan.sdo.DepartmentContractRedLineSDO;
import lombok.Getter;
import lombok.Setter;

/**
 * @author wangyibing
 */
public class DepartmentContractRedLineEntity {
    @Getter
    @Setter
    private DepartmentContractRedLineSDO departmentContractRedLineSDO;

    private static DepartmentContractRedLineRepository contractRedLineRepository;

    static {
        contractRedLineRepository = SpringContextUtil.getBean(DepartmentContractRedLineRepository.class);
    }

    public static DepartmentContractRedLineEntity of(DepartmentContractRedLineSDO departmentContractRedLineSDO) {
        DepartmentContractRedLineEntity entity = new DepartmentContractRedLineEntity();
        entity.setDepartmentContractRedLineSDO(departmentContractRedLineSDO);
        return entity;
    }

    public String doCreate() {
        return contractRedLineRepository.createContractRedLine(departmentContractRedLineSDO);
    }
}
